package com.neusoft.shopingapi.service;

        import com.neusoft.shopingapi.dao.PictureDAOImpl;
        import com.neusoft.shopingapi.entity.PictureEntity;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.stereotype.Service;

        import java.util.ArrayList;
        import java.util.List;

@Service
public class PictureService {
    @Autowired
    private PictureDAOImpl dao;
    public List<PictureEntity> qureyOneAll(Integer goodsno){
        return dao.qureyOneAll(goodsno);
    }

    public List<PictureEntity> qureyFirst(Integer goodsno){
        return dao.qureyFirst(goodsno);
    }

    public List<String> qureyFirstUrl(Integer goodsno){
        List<String > urls=new ArrayList<>();
        dao.qureyFirst(goodsno).forEach(pictureEntity -> {
            urls.add(pictureEntity.getUrl());
        });
        return urls;
    }
    public List<String > qureyOneAllUrl(Integer goodsno){
        List<String > urls=new ArrayList<>();
        dao.qureyFirst(goodsno).forEach(pictureEntity -> {
            urls.add(pictureEntity.getUrl());
        });
        return urls;
    }
}
